#pragma once

#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>

#include "exports.hpp"
#include "Reply.h"




/**
 * This class offers the basic interface for a DataProvider implementation.
 * Each DataProcessor is given one DataProvider that can be used to fetch
 * the actual data from a website and then process it, or to insert new data
 * to be processed.
 *
 * Data is fetched in a defined sequence that can not be changed. In the case
 * that there is no data available, the DataProcessor shall wait for some seconds
 * and then try again.
 */
class CRAWLER_API DataProvider
	: public boost::noncopyable
{
public:

	typedef boost::shared_ptr<DataProvider>         Ptr;
	typedef boost::shared_ptr<const DataProvider>   const_Ptr;

	/**
	 * Returns the next reply (if available).
	 * If no reply is returned, then the DataProvider shall wait for
	 * several seconds, before trying again.
	 *
	 * Every implementation is required to make this function thread-safe.
	 */
	virtual Reply::Opt next() = 0;

	/**
	 * Inserts this reply into the DataProvider.
	 */
	virtual void insert(const Reply& reply) = 0;
};
///////////////////////////////////////////////////////////////////////////////////////////////////
